package com.example.design.创建型设计模式.抽象工厂模式;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Computer {
    private CPU cpu;
    private Memory memory;
    private HardDisk hardDisk;

    public Computer(ComputerFactory factory) {
        this.cpu = factory.createCPU();
        this.memory = factory.createMemory();
        this.hardDisk = factory.createHardDisk();
    }

    public void printComponents() {
        System.out.println("CPU: " + cpu.getName());
        System.out.println("Memory: " + memory.getName());
        System.out.println("Hard Disk: " + hardDisk.getName());
    }
}
